' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.12.16.16.28]) on 2024.03.05 at 03:52 (Coordinated Universal Time)
' BAM port and mod by Charlie Veniot
' of "colorful level curve chart" by Luis Alberto Migliorero
' shared on Facebook (https://www.facebook.com/groups/2057165187928233/permalink/3587919178186152/?mibextid=uJjRxr)

SCREEN _NEWIMAGE(580,400,17)
color 15,0
INC% = 0
DrawCycle:
  _DISPLAY
  color ,col2
  cls
  FOR X = -300 TO 300 STEP 5
    FOR Y = -300 TO 300 STEP 3
      GOSUB L3
      NY = -Y * 1 + X * 1 * 0.5 + 290 : NZ = Z * 1 + X * 1 * 0.7 + 190
      LINE (NY, NZ)-(NY, 480), 0
      IF Y = -300 THEN
         col = INT( ABS(Z) * 31 / 80 + 1 + INC%) MOD 65
         PSET (NY, NZ), col
      ELSE
         col =  INT( ABS(Z) * 31 / 80 + 1  + INC% ) MOD 65
         LINE (PY, PZ)-(NY, NZ), col
      END IF
      PY = NY: PZ = NZ
    NEXT Y
    _DISPLAY : sleep 0.001
  NEXT X
  SLEEP 2
  INC% = INC% + 1
GOTO DrawCycle  
END

L3: 'Function Z(X,Y) for the figure WAVES
Z = 100 * ABS(X) ^ 0.5 * Y / (( Y + 1) ^ 2 + 30) * SIN(0.08 * ((X ^ 2 + Y ^ 2) ^ 0.5))
CONTINUE:
RETURN